<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>响应式布局示例</title>
    <style>
        /* 重置默认样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* 容器布局 */
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        /* 导航栏 */
        nav {
            background: #333;
            padding: 1rem;
        }

        .nav-list {
            display: flex;
            list-style: none;
            gap: 2rem;
            justify-content: center;
        }

        .nav-list a {
            color: white;
            text-decoration: none;
            font-size: 1.1rem;
        }

        /* 主要内容区域 */
        .main-content {
            display: grid;
            gap: 2rem;
            margin: 2rem 0;
        }

        /* 卡片布局 */
        .card {
            background: #f5f5f5;
            padding: 1.5rem;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        /* 侧边栏 */
        .sidebar {
            background: #eee;
            padding: 1.5rem;
            border-radius: 8px;
        }

        /* 页脚 */
        footer {
            background: #333;
            color: white;
            text-align: center;
            padding: 1rem;
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        /* 响应式设计 */
        @media (min-width: 768px) {
            .main-content {
                grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            }
        }

        @media (max-width: 767px) {
            .nav-list {
                flex-direction: column;
                align-items: center;
                gap: 1rem;
            }

            .card {
                margin-bottom: 1rem;
            }
        }

        /* 图片响应式 */
        img {
            max-width: 100%;
            height: auto;
            display: block;
        }
    </style>
</head>

<body>
    <nav>
        <div class="container">
            <ul class="nav-list">
                <li><a href="#">首页</a></li>
                <li><a href="#">产品</a></li>
                <li><a href="#">服务</a></li>
                <li><a href="#">关于我们</a></li>
            </ul>
        </div>
    </nav>

    <main class="container">
        <div class="main-content">
            <article class="card">
                <h2>最新消息</h2>
                <p>这里是主要内容区域，展示网站的最新动态和重要信息。</p>
            </article>

            <aside class="sidebar">
                <h3>侧边栏</h3>
                <ul>
                    <li>相关链接1</li>
                    <li>相关链接2</li>
                    <li>相关链接3</li>
                </ul>
            </aside>
        </div>
    </main>

    <footer>
        <div class="container">
            <p>&copy; 2025 公司名称 版权所有</p>
        </div>
    </footer>
</body>

</html>